﻿using System;

namespace enyo.db8
{    
    [NonScript]
    public abstract class Operator
    {
        public static implicit operator Operator(string val)
        {
            return null;
        }

        [EvalAtCompile]
        public const string LessThan = "<";

        [EvalAtCompile]
        public const string LessThanOrEqual = "<=";

        [EvalAtCompile]
        public const string Equal = "=";

        [EvalAtCompile]
        public const string GreaterThan = ">";

        [EvalAtCompile]
        public const string GreaterThanOrEqual = ">";

        [EvalAtCompile]
        public const string NotEqual = "!=";

        /// <summary>
        /// will return all matches beginning with the value specified.
        /// </summary>
        [EvalAtCompile]
        public const string Wildcard = "%";

        [EvalAtCompile]
        public const string FullText = "?";
    }

    public class WhereClause
    {
        /// <summary>
        /// Name of property to test.
        /// </summary>
        public string Prop;

        /// <summary>
        /// Test operator.
        /// </summary>
        public Operator Op;

        /// <summary>
        /// Value to test against.
        /// </summary>
        public object Val;

        //TODO:object collate; Indicates the string comparison routine used to order the results. See the collate field in the IndexPropClause data structure for more information.
    }
}
